Add accessibility-backed text manipulation#968
Open
jamilahmadzai wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds an optional Dragonfly accessibility path for the existing Caster text manipulation commands.
When Dragonfly exposes focused editable text through its accessibility controller, Caster now uses that focused text range for:
grab/ select phrasegrab ... until ...go/moveto a phrase boundaryreplace ... with ...removephraseremove ... until ...The existing clipboard-based behavior remains the fallback when accessibility is unavailable, the focused control is not editable, or the requested phrase cannot be found through accessibility.
Related Issue
Refs #814
Approach overview posted in the issue: #814 (comment)
Motivation and Context
Issue #814 asks for Select-and-Say-style text navigation through OS accessibility APIs. The issue discussion points toward using Dragonfly's existing accessibility controller rather than adding a separate Caster-specific backend or a new dependency.
This PR keeps the change scoped to Caster's current text manipulation commands. It uses Dragonfly's focused editable text when available, handles Caster's existing left/right/up/down search-window semantics, treats CRLF and Dragonfly text-node delimiters as boundaries, and avoids clipboard selection/copy when the accessibility path succeeds.
How Has This Been Tested
Local environment: Python 3.10 via
uvon macOS.python -m unittest tests.lib.test_text_manipulation_accessibility -vpython tests/testrunner.pypython -m py_compile castervoice/rules/core/text_manipulation_rules/accessibility_text.py castervoice/rules/core/text_manipulation_rules/text_manipulation_support.py tests/lib/test_text_manipulation_accessibility.pypylint -E castervoice/rules/core/text_manipulation_rules/accessibility_text.py castervoice/rules/core/text_manipulation_rules/text_manipulation_support.pygit diff --checkThe added tests use fake focused accessibility text objects to validate range selection, cursor movement, replacement/deletion actions, CRLF boundaries, Dragonfly text-node delimiters, non-editable fallback, and that successful accessibility handling returns before the clipboard fallback path.
This does not add or validate a new OS accessibility backend; it is the Caster-side integration against Dragonfly's existing controller surface.
Bounty / payout
IssueHunt payout: @jamilahmadzai
Types of changes
Checklist
Maintainer/Reviewer Checklist
IssueHunt Summary
Referenced issues
This pull request has been submitted to: